<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */
    
    /*********************************************************
    *            --== InArch ==--
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 08.08.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/

    /***
    * class ajaxPublishPage
    ****
    * This class will publish a page
    ****
    * @package ajax
    * @author A Kulikov <a.kulikov@gmail.com>
    * @version n/a
    * @since 08.08.2005
    * @copyright essentialmind.com 2005
    ***/
    class ajaxPublishPage extends ajaxAction{

        public function process(){
            $id = (int)$_REQUEST['id'];
            
            //try to drop the page
            try{
                //get rid of the reference to the node
                $this->db->Execute("UPDATE pagemap SET wf_state = 1 WHERE version = 1 AND id = " . $id);
                
                //log action
                $this->log->recordAction("Ajax: Published Page (".$id.")");
                
            //something went wrong
            }catch(exception $e){
                //log error
                $this->log->recordError($e->getMessage());

                //do nothing
            }
            
            $this->smarty->assign('id',$id);
            $this->r->html = $this->smarty->preFetch('ajax'.DIRECTORY_SEPARATOR.'publishPage.html');
        }
    }
?>